<template>
  <div v-on:click="test1()" style="margin-top: 100px;background: red;">
    this is my {{title}}{{count}}
    <br/>
    我是组件
  </div>
</template>

<script>
  export default {
    computed: {
      count () {
//	    	console.log(this.$store.getters.count)
        return this.$store.getters.count;
      }
    },
    data() {
      return {
//				count: 10,
        title: "component",
      }
    },
    methods: {
      test1: function () {
        this.$store.commit('increment')
//				alert("我是来自组件的3333值"+this.$store.getters.count, 1000)
      },
    },
    watch: {
      // 如果 question 发生改变，这个函数就会运行
      count: function (newQuestion) {
        console.log(newQuestion)
      }
    }
  }

</script>
